/**
 * This code is released under lgpl v3 license.
 * All rights reserved.
*/

package flash.net;

import bridge.FABridge;
import flash.events.EventDispatcher;
import javascript.util.Date;


/**
 * FileReference overlay type
 * @author yuan yunchang    dukerr@gmail.com
 */
public class FileReference extends EventDispatcher{
    static String className = "flash.net.FileReference";
    protected FileReference() {
    }


    public final static  FileReference createFileReference(String bridgeName){
        return (FileReference)(FABridge.get().getInstance(bridgeName).create(className));
    }
    public final native boolean browse()/*-{
        return this.browse()
    }-*/;
    public native final void cancel()/*-{
    this.cancel()
    }-*/;
    public native final void download(URLRequest req,String defaultFileName)/*-{
    this.download(req,defaultFileName)
    }-*/;

    /**
     *
     * @return  file name include extension name
     */
    public final native String getName()/*-{
        return this.getName()
    }-*/;
    
    /**
     * 
     * @return  bytes
     */
    public final native double getSize()/*-{
        return this.getSize()
    }-*/;
    /**
     * 
     * @return  extension name include ".",for example ".zip"
     */
    public final native String getType()/*-{
        return this.getType()
    }-*/;
    public final native void upload(URLRequest urlReq,String fieldName)/*-{
        this.upload(urlReq,fieldName)
    }-*/;
    public native final Date getCreationDate()/*-{
    return this.getCreationDate()
    }-*/;
    public native final Date getModificationDate ()/*-{
    return this.getModificationDate()
    }-*/;
}
